package com.example.demo;

import io.micrometer.core.instrument.DistributionSummary;
import io.micrometer.core.instrument.simple.SimpleMeterRegistry;
import org.junit.Test;

/**
 * @author lizhien (zhien.li@nascent.cn)
 * @version 1.0.0
 * @date 2022/3/18 16:02
 * @description com.example.demo
 */

public class SummarySample {

    @Test
    public void testSummary() {

        DistributionSummary summary = DistributionSummary.builder("summary")
            .tag("summary", "summarySample")
            .description("summary sample test")
            .register(new SimpleMeterRegistry());

        summary.record(2D);
        summary.record(3D);
        summary.record(4D);

        System.out.println(summary.count());
        System.out.println(summary.measure());
        System.out.println(summary.max());
        System.out.println(summary.mean());
        System.out.println(summary.totalAmount());
    }

}
